package Lambda;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

public class T {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        System.out.println(c);
//        Object[] arr = c.toArray();//不常用
        String[] arr =  c.toArray(new String[c.size()]);
//        String[] arr =  c.toArray(new String[10]);
//        String[] arr =  c.toArray(new String[1]);
        System.out.println(arr.length);
        System.out.println(Arrays.toString(arr));
    }
}
